﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using DomainDriver.DomainModeling.DomainObjects;

namespace AutomotivePricingModel.Dealers
{
    public class DealerBrandRelation : DomainObjectBase<DealerBrandRelation>
    {
        private Guid m_ParentDealerId;
        private Guid m_RelatedBrandId;

        public DealerBrandRelation()
            : this(Guid.Empty, Guid.Empty)
        { }

        public DealerBrandRelation(Guid parentDealerId, Guid relatedBrandId)
        {
            m_ParentDealerId = parentDealerId;
            m_RelatedBrandId = relatedBrandId;
        }

        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        [Column(Order = 0)]
        public Guid ParentDealerId
        {
            get { return m_ParentDealerId; }
            set { m_ParentDealerId = value; }
        }

        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        [Column(Order = 1)]
        public Guid RelatedBrandId
        {
            get { return m_RelatedBrandId; }
            set { m_RelatedBrandId = value; }
        }

        #region DomainObject Methods

        public override DealerBrandRelation Copy()
        {
            DealerBrandRelation copy = new DealerBrandRelation();
            CopyTo(copy);
            return copy;
        }

        public override void CopyTo(DealerBrandRelation otherObject)
        {
            otherObject.m_ParentDealerId = m_ParentDealerId;
            otherObject.m_RelatedBrandId = m_RelatedBrandId;
        }

        public override bool Equals(DealerBrandRelation otherObject)
        {
            if (otherObject.m_ParentDealerId != m_ParentDealerId)
            { return false; }
            if (otherObject.m_RelatedBrandId != m_RelatedBrandId)
            { return false; }
            return true;
        }

        #endregion
    }
}